from django.contrib import admin
from torque.invite.models import Invite

class InviteAdmin(admin.ModelAdmin):
    def save_model(self, request, obj, form, change):
        obj.inviter = request.user
        obj.save()
        if obj.sent == False:
	        obj.send_invite()
        	obj.sent = True
	        obj.save()    

    list_filter = ['enabled','creation']
    exclude = ['sent','inviter','accepted','declined','code']    
    pass
    
admin.site.register(Invite, InviteAdmin)
